<?php
$lib_rupiah = new Format_rupiah();
?>

    <div class="member">

        <div class="grid_4 alpha omega">
                <h4>ALAMAT PEMESAN</h4>
                <p> <span> Nama Depan </span> : <b > <?php echo $list_data->nama_depan ?> </b> </p> 
                <p> <span> Nama Belakang </span> : <b><?php echo $list_data->nama_belakang ?> </b></p>
                <p> <span> Provinsi </span> : <b><?php echo $list_data->nama_provinsi1 ?> </b></p>
                <p> <span> Kota</span> : <b><?php echo $list_data->nama_kota1 ?> </b></p>
                <p> <span> Alamat</span> : <b><?php echo $list_data->alamat ?> </b></p>
                <p> <span> Kode Pos</span>: <b><?php echo $list_data->kode_pos ?> </b></p>
                <p> <span> Telp</span> : <b><?php echo $list_data->telp ?> </b></p>
            </div>

            <div class="grid_4  ">
                <h4>ALAMAT PENGIRIMAN</h4>
                <p> <span> Nama Depan </span> : <b> <?php echo $list_data->nama_depan2 ?> </b> </p> 
                <p> <span> Nama Belakang </span> : <b><?php echo $list_data->nama_belakang2 ?> </b></p>
                <p> <span> Provinsi </span> : <b><?php echo $list_data->nama_provinsi2 ?> </b></p>
                <p> <span> Kota</span> : <b><?php echo $list_data->nama_kota2 ?> </b></p>
                <p> <span> Alamat</span> : <b><?php echo $list_data->alamat2 ?> </b></p>
                <p> <span> Kode Pos</span>: <b><?php echo $list_data->kode_pos2 ?> </b></p>
                <p> <span> Telp</span> : <b><?php echo $list_data->telp2 ?> </b></p>
            </div>

            <div class="grid_4 alpha omega">
                <h4>INFORMASI PEMESANAN</h4>
                <p> <span> Order ID  </span> : <b> 
                        <?php
                        $id_transaksi = $list_data->id;
                        echo $id_transaksi;
                        ?> </b> </p> 
                <p> <span> Tanggal  </span> : <b><?php echo $list_data->date ?> </b></p>
                <p> <span> Pembayaran </span> : <b><?php echo $list_data->jenis_pembayaran ?> </b></p>
                <p  style="display: block"> <span> Sub Total </span> : <b  style="text-align: right;" ><?php echo $lib_rupiah->rupiah($list_data->sub_total) ?> </b></p>
                <p> <span> Ongkos Kirim </span> : <b><?php echo $lib_rupiah->rupiah($list_data->biaya_kirim) ?> </b></p>
                <p> <span> Grand Total</span>: <b><?php echo $lib_rupiah->rupiah($list_data->grand_total) ?> </b></p>
                <?php
                $status = "";
                if ($list_data->status == 2)
                    $status = "Sukses";
                else if ($list_data->status == 1)
                    $status = "Gagal";
                else {
                    $tgl1 = date('Y-m-d'); // 1 Oktober 2010

                    $pecah1 = explode("-", $tgl1);
                    $date1 = $pecah1[2];
                    $month1 = $pecah1[1];
                    $year1 = $pecah1[0];

                    $tgl2 = $list_data->date; // 10 Oktober 2010
                    $date2 = substr($tgl2, 8, 2);
                    $month2 = substr($tgl2, 5, 2);
                    $year2 = substr($tgl2, 0, 4);

                    $jd1 = GregorianToJD($month1, $date1, $year1);
                    $jd2 = GregorianToJD($month2, $date2, $year2);

                    //pengurangan jadi nilai hari
                    $selisih = $jd1 - $jd2;

                    if ($selisih <= 2)
                        $status = "Proses";
                    else
                        $status = "Gagal";
                }
                ?>
                <p> <span> Order Status</span> : <b><?php echo $status ?> </b></p>
            </div>


            <div class="clear"></div>
            <br/>
            <br/>
            <p>
                <b>Komentar seputar pemesanan</b> <br/>

                <label>

                    <textarea readonly  cols="70" rows="4"  id="komentar" name="komentar"><?php echo $list_data->komentar ?></textarea>

                </label>


            </p> <br/>

            <table>
                <tr>
                    <th width="40%"> Nama Produk </th>
                    <th> Harga</th>
                    <th> Qty </th>
                    <th> Sub Total </th>
                    <th> Diskon </th>
                    <th> Total </th>
                </tr>
                <?php
                $lib_rupiah = new Format_rupiah();
                $lib_img = new images_thumb();
                foreach ($list_data_det as $dta_det) {
                    $gambar = base_url() . "uploads/" . $dta_det->id_produk . "/" . $lib_img->image($dta_det->image1);
                    echo "<tr class='biaya' >";
                    echo "<td><img src='$gambar' width='100' align='left' style='margin-right:5px;'/> 
                            <p style='text-align:left;'> Kode Produk : <b>$dta_det->id_produk</b> <br/> 
                            Ukuran Produk : <b>$dta_det->size_produk</b> <br/> 
                            Warna Produk : <b>$dta_det->warna</b> <br/> 
                            </p> <br/></td>";
                    echo "<td> <p  style='text-align:right;'> " . $lib_rupiah->rupiah($dta_det->harga) . " </p> </td>";
                    echo "<td> <p> $dta_det->bnyk </p> </td>";
                    echo "<td> <p style='text-align:right;'> " . $lib_rupiah->rupiah($dta_det->total) . " </p> </td>";
                    echo "<td> <p> $dta_det->disk %</p> </td>";
                    echo "<td> <p  style='text-align:right;'> " . $lib_rupiah->rupiah($dta_det->sub_total) . " </p> </td>";
                    echo "</tr>";
                }
                ?>

            </table>
<br/>
            <?php
            echo anchor("admin_transaksi/", "   Kembali   ", "class='button' style='color:#f8f8f8'");

            if ($status == "Proses") {
                echo anchor("admin_transaksi/update_status/$id_transaksi/1/", "   Gagalkan Pemesanan  ", "class='button' style=' color:#f8f8f8; float:right; margin-left:5px;'");

                echo anchor("admin_transaksi/update_status/$id_transaksi/2/", "   Pembayaran Lunas    ", "class='button' style='float:right; color:#f8f8f8; '");
            } else if ($status == "Gagal") {
                echo anchor("admin_transaksi/update_status/$id_transaksi/0/", "   Ubah Status Proses  ", "class='button' style='float:right; margin-left:5px; color:#f8f8f8; '");
            } else if ($status == "Sukses") {
                echo anchor("admin_transaksi/update_status/$id_transaksi/1/22", "   Gagalkan Pemesanan  ", "class='button' style='float:right; margin-left:5px; color:#f8f8f8; '");
                echo anchor("admin_transaksi/update_status/$id_transaksi/0/22", "   Ubah Status Proses  ", "class='button' style='float:right; margin-left:5px; color:#f8f8f8; '");
            }
            ?>

            <br/><br/>




    </div>
